package com.remenote.remenoteback.controller;

import com.remenote.remenoteback.entity.req.GroupReq;
import com.remenote.remenoteback.entity.resp.ServerResponse;
import com.remenote.remenoteback.entity.vo.NoteVo;
import com.remenote.remenoteback.entity.vo.StudyGroupVo;
import com.remenote.remenoteback.service.StudyGroupService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/studygroup")
public class StudyGroupController {
    @Autowired
    private StudyGroupService studyGroupService;

    @PostMapping("/all")
    public ServerResponse<List<StudyGroupVo>> findAllStudyGroup(){
        return studyGroupService.findAll();
    }
    @PostMapping("/findgroupnote")
    public ServerResponse<List<NoteVo>> findGroupNote(){
        return studyGroupService.findGroupNote();
    }
    @PostMapping("/create")
    public ServerResponse createStudyGroup(@RequestBody GroupReq group){
       return studyGroupService.createStudyGroup(group.getGroupName());
    }

    @PostMapping("/find")
    public ServerResponse findStudyGroup(@RequestBody GroupReq group){
        return studyGroupService.findStudyGroup(group.getGroupName());
    }
    @PostMapping("/search")
    public ServerResponse searchInventory(@RequestBody GroupReq group){
        return studyGroupService.searchInventory(group.getGroupName());
    }

}